<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>前端与反爬虫 | Tab</title><meta name="keywords" content="安全"><meta name="author" content="Tab"><meta name="copyright" content="Tab"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="前端与反爬虫 爬虫爬取数据主要是从 dom 节点上获取的，那么我们前端可以在 dom 节点上搞点骚操作来干扰爬虫抓取数据  1.1 字符串穿插在 html 字符间插入无关紧要的元素来达到干扰爬虫的效果 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647&#x2F;** * 获取随机中文字">
<meta property="og:type" content="article">
<meta property="og:title" content="前端与反爬虫">
<meta property="og:url" content="https://tabxx.github.io/tab.github.io/2019/10/30/fe-crawler/index.html">
<meta property="og:site_name" content="Tab">
<meta property="og:description" content="前端与反爬虫 爬虫爬取数据主要是从 dom 节点上获取的，那么我们前端可以在 dom 节点上搞点骚操作来干扰爬虫抓取数据  1.1 字符串穿插在 html 字符间插入无关紧要的元素来达到干扰爬虫的效果 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647&#x2F;** * 获取随机中文字">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://tabxx.github.io/tab.github.io/2019/10/30/fe-crawler/topbg.jpg">
<meta property="article:published_time" content="2019-10-30T10:49:46.000Z">
<meta property="article:modified_time" content="2021-08-11T11:36:20.314Z">
<meta property="article:author" content="Tab">
<meta property="article:tag" content="安全">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://tabxx.github.io/tab.github.io/2019/10/30/fe-crawler/topbg.jpg"><link rel="shortcut icon" href="/tab.github.io/images/favicon.ico"><link rel="canonical" href="https://tabxx.github.io/tab.github.io/2019/10/30/fe-crawler/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//hm.baidu.com"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/tab.github.io/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>var _hmt = _hmt || [];
(function() {
  var hm = document.createElement("script");
  hm.src = "https://hm.baidu.com/hm.js?050bcda3cb147a8c0de1c17a337c5466";
  var s = document.getElementsByTagName("script")[0]; 
  s.parentNode.insertBefore(hm, s);
})();
</script><script>const GLOBAL_CONFIG = { 
  root: '/tab.github.io/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: true,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '前端与反爬虫',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-08-11 19:36:20'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
          const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
          const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
          const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified

          if (t === undefined) {
            if (isLightMode) activateLightMode()
            else if (isDarkMode) activateDarkMode()
            else if (isNotSpecified || hasNoSupport) {
              const now = new Date()
              const hour = now.getHours()
              const isNight = hour <= 6 || hour >= 18
              isNight ? activateDarkMode() : activateLightMode()
            }
            window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
              if (saveToLocal.get('theme') === undefined) {
                e.matches ? activateDarkMode() : activateLightMode()
              }
            })
          } else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    })(window)</script><meta name="generator" content="Hexo 5.1.1"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" src= "" data-lazy-src="/tab.github.io/images/avatar.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/tab.github.io/archives/"><div class="headline">文章</div><div class="length-num">10</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tab.github.io/tags/"><div class="headline">标签</div><div class="length-num">7</div></a></div></div></div><hr/></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/tab.github.io/2019/10/30/fe-crawler/topbg.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/tab.github.io/">Tab</a></span><div id="menus"><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">前端与反爬虫</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2019-10-30T10:49:46.000Z" title="发表于 2019-10-30 18:49:46">2019-10-30</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-08-11T11:36:20.314Z" title="更新于 2021-08-11 19:36:20">2021-08-11</time></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">685</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>3分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="前端与反爬虫"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="前端与反爬虫"><a href="#前端与反爬虫" class="headerlink" title="前端与反爬虫"></a>前端与反爬虫</h1><blockquote>
<p>爬虫爬取数据主要是从 dom 节点上获取的，那么我们前端可以在 dom 节点上搞点骚操作来干扰爬虫抓取数据</p>
</blockquote>
<h3 id=""><a href="#" class="headerlink" title=""></a></h3><p><strong>1.1 字符串穿插</strong><br>在 html 字符间插入无关紧要的元素来达到干扰爬虫的效果</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 获取随机中文字</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">const</span> randomText = <span class="function">() =&gt;</span> &#123;</span><br><span class="line">    <span class="keyword">let</span> _len = <span class="number">2</span></span><br><span class="line">    <span class="keyword">let</span> i = <span class="number">0</span></span><br><span class="line">    <span class="keyword">let</span> _str = <span class="string">&#x27;&#x27;</span></span><br><span class="line">    <span class="keyword">let</span> _base = <span class="number">20000</span></span><br><span class="line">    <span class="keyword">let</span> _range = <span class="number">1000</span></span><br><span class="line">    <span class="keyword">while</span> (i &lt; _len) &#123;</span><br><span class="line">        i++</span><br><span class="line">        <span class="keyword">var</span> _lower = <span class="built_in">parseInt</span>(<span class="built_in">Math</span>.random() * _range)</span><br><span class="line">        _str += <span class="built_in">String</span>.fromCharCode(_base + _lower)</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> _str</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"><span class="keyword">const</span> randomStyle = <span class="function">() =&gt;</span> &#123;</span><br><span class="line">    <span class="keyword">let</span> css = [</span><br><span class="line">        <span class="string">&#x27;margin:-100px;&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;top:100%;&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;border: 1px solid red;&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;flex-grow: 1;&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;width: 1000px&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;color: #fff&#x27;</span>,</span><br><span class="line">        <span class="string">&#x27;overflow: hidden;&#x27;</span></span><br><span class="line">    ]</span><br><span class="line">    <span class="keyword">let</span> style = <span class="string">&#x27;display:none;&#x27;</span></span><br><span class="line">    <span class="keyword">let</span> num = <span class="built_in">Math</span>.floor(<span class="built_in">Math</span>.random() * <span class="number">7</span>)</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">let</span> i = <span class="number">0</span>; i &lt;= num; i++) &#123;</span><br><span class="line">        style += css[i]</span><br><span class="line">    &#125;</span><br><span class="line">    <span class="keyword">return</span> style</span><br><span class="line">&#125;</span><br><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span><br><span class="line">    bind(el, &#123;</span><br><span class="line">        value</span><br><span class="line">    &#125;) &#123;</span><br><span class="line">        <span class="comment">// 字符串穿插</span></span><br><span class="line">        <span class="keyword">let</span> fontNum = <span class="string">&#x27;&#x27;</span>;</span><br><span class="line">        <span class="keyword">let</span> numberArray = value.toString().split(<span class="string">&#x27;&#x27;</span>)</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">let</span> item <span class="keyword">of</span> numberArray) &#123;</span><br><span class="line">            fontNum += <span class="string">`<span class="subst">$&#123;item&#125;</span>&lt;span style=&quot;<span class="subst">$&#123;randomStyle()&#125;</span>&quot;&gt;<span class="subst">$&#123;randomText()&#125;</span>&lt;/span&gt;`</span></span><br><span class="line">        &#125;</span><br><span class="line">        el.innerHTML = fontNum;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>



<p><strong>1.2 元素定位覆盖</strong><br>根据数据位数生成<code>位数*2</code>个标签，然后通过定位将正确数据覆盖在错误数据</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span><br><span class="line">    bind(el, &#123;</span><br><span class="line">        value</span><br><span class="line">    &#125;) &#123;</span><br><span class="line">        <span class="keyword">let</span> &#123; data, w &#125; = value;</span><br><span class="line">        <span class="comment">// 定位法</span></span><br><span class="line">        <span class="keyword">if</span> (!el.style.position) &#123;</span><br><span class="line">          el.style.position = <span class="string">&#x27;relative&#x27;</span>;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 每一位分割成字符串数组</span></span><br><span class="line">        <span class="keyword">let</span> valueArray = data.toString().split(<span class="string">&#x27;&#x27;</span>);</span><br><span class="line">        <span class="comment">// 干扰个数</span></span><br><span class="line">        <span class="keyword">let</span> fakeNum = <span class="built_in">Math</span>.floor(<span class="built_in">Math</span>.random() * valueArray.length);</span><br><span class="line">        fakeNum = fakeNum ? fakeNum : <span class="number">1</span>;</span><br><span class="line">        <span class="keyword">let</span> newHTML = [];</span><br><span class="line">        <span class="keyword">let</span> normalStyle = [<span class="string">&#x27;font-style: normal&#x27;</span>, <span class="string">&#x27;background: #252527&#x27;</span>, <span class="string">&#x27;position:absolute&#x27;</span>];</span><br><span class="line">        newHTML = valueArray.map(<span class="function">(<span class="params">item, index</span>) =&gt;</span> &#123;</span><br><span class="line">          <span class="keyword">let</span> s = [...normalStyle, ...[<span class="string">`left: <span class="subst">$&#123;index * w&#125;</span>px`</span>, <span class="string">`width:<span class="subst">$&#123;w&#125;</span>px`</span>]].join(<span class="string">&#x27;;&#x27;</span>);</span><br><span class="line">          <span class="keyword">return</span> <span class="string">`&lt;i style=&quot;<span class="subst">$&#123;s&#125;</span>&quot;&gt;<span class="subst">$&#123;item&#125;</span>&lt;/i&gt;`</span>;</span><br><span class="line">        &#125;);</span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">let</span> i = <span class="number">0</span>; i &lt;= fakeNum; i++) &#123;</span><br><span class="line">          <span class="keyword">let</span> n = <span class="built_in">Math</span>.floor(<span class="built_in">Math</span>.random() * <span class="number">9</span>);</span><br><span class="line">          <span class="keyword">let</span> s = [...normalStyle, ...[<span class="string">`left: <span class="subst">$&#123;i * w&#125;</span>px`</span>, <span class="string">`width:<span class="subst">$&#123;w&#125;</span>px`</span>]].join(<span class="string">&#x27;;&#x27;</span>);</span><br><span class="line">          newHTML.unshift(<span class="string">`&lt;i style=&quot;<span class="subst">$&#123;s&#125;</span>&quot;&gt;<span class="subst">$&#123;n&#125;</span>&lt;/i&gt;`</span>);</span><br><span class="line">        &#125;</span><br><span class="line">        el.style.width = valueArray.length * w + <span class="string">&#x27;px&#x27;</span>;</span><br><span class="line">        el.style.height = <span class="string">&#x27;12px&#x27;</span>;</span><br><span class="line">        el.innerHTML = newHTML.join(<span class="string">&#x27;&#x27;</span>);</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>



<p><strong>1.1 <a target="_blank" rel="noopener" href="https://juejin.im/post/5b6d579cf265da0f6e51a7e0">font-face 拼凑</a></strong></p>
<p>font-face 定义一套自己的字符集，页面引用对应的 unicode</p>
<figure class="highlight css"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">@font-face</span> &#123;</span><br><span class="line">  <span class="attribute">font-family</span>: <span class="string">&#x27;iconfont&#x27;</span>;</span><br><span class="line">  <span class="attribute">src</span>: <span class="built_in">url</span>(<span class="string">&#x27;./font/iconfont.eot&#x27;</span>);</span><br><span class="line">  <span class="attribute">src</span>: <span class="built_in">url</span>(<span class="string">&#x27;./font/iconfont.eot?#iefix&#x27;</span>) <span class="built_in">format</span>(<span class="string">&#x27;embedded-opentype&#x27;</span>), <span class="built_in">url</span>(<span class="string">&#x27;./font/iconfont.woff2&#x27;</span>)</span><br><span class="line">      <span class="built_in">format</span>(<span class="string">&#x27;woff2&#x27;</span>), <span class="built_in">url</span>(<span class="string">&#x27;./font/iconfont.woff&#x27;</span>) <span class="built_in">format</span>(<span class="string">&#x27;woff&#x27;</span>), <span class="built_in">url</span>(<span class="string">&#x27;./font/iconfont.ttf&#x27;</span>)</span><br><span class="line">      <span class="built_in">format</span>(<span class="string">&#x27;truetype&#x27;</span>), <span class="built_in">url</span>(<span class="string">&#x27;./font/iconfont.svg#iconfont&#x27;</span>) <span class="built_in">format</span>(<span class="string">&#x27;svg&#x27;</span>);</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

<figure class="highlight html"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="tag">&lt;<span class="name">span</span>&gt;</span><span class="symbol">&amp;#xe603;</span><span class="symbol">&amp;#xe607;</span><span class="symbol">&amp;#xe607;</span><span class="tag">&lt;/<span class="name">span</span>&gt;</span></span><br></pre></td></tr></table></figure>

<p>自定义指令 v-fontface</p>
<figure class="highlight javascript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">const</span> fontface = [</span><br><span class="line">  <span class="string">&#x27;&amp;#xe600;&#x27;</span>,</span><br><span class="line">  <span class="string">&#x27;&amp;#xe609;&#x27;</span>,</span><br><span class="line">  <span class="string">&#x27;&amp;#xe607;&#x27;</span>,</span><br><span class="line">  <span class="string">&#x27;&amp;#xe610;&#x27;</span>,</span><br><span class="line">  <span class="string">&#x27;&amp;#xe606;&#x27;</span>,</span><br><span class="line">  <span class="string">&#x27;&amp;#xe605;&#x27;</span>,</span><br><span class="line">  <span class="string">&#x27;&amp;#xe604;&#x27;</span>,</span><br><span class="line">  <span class="string">&#x27;&amp;#xe603;&#x27;</span>,</span><br><span class="line">  <span class="string">&#x27;&amp;#xe602;&#x27;</span>,</span><br><span class="line">  <span class="string">&#x27;&amp;#xe601;&#x27;</span></span><br><span class="line">]</span><br><span class="line"><span class="keyword">export</span> <span class="keyword">default</span> &#123;</span><br><span class="line">  bind(el, &#123; value &#125;) &#123;</span><br><span class="line">    <span class="keyword">let</span> fontNum = <span class="string">&#x27;&#x27;</span></span><br><span class="line">    <span class="keyword">let</span> numberArray = value.toString().split(<span class="string">&#x27;&#x27;</span>)</span><br><span class="line">    <span class="keyword">for</span> (<span class="keyword">let</span> item <span class="keyword">of</span> numberArray) &#123;</span><br><span class="line">      fontNum += fontface[item] ? fontface[item] : item</span><br><span class="line">    &#125;</span><br><span class="line">    el.innerHTML = fontNum</span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>

</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">Tab</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://tabxx.github.io/tab.github.io/2019/10/30/fe-crawler/">https://tabxx.github.io/tab.github.io/2019/10/30/fe-crawler/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://tabxx.github.io/tab.github.io" target="_blank">Tab</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tab.github.io/tags/%E5%AE%89%E5%85%A8/">安全</a></div><div class="post_share"><div class="social-share" data-image="/tab.github.io/2019/10/30/fe-crawler/topbg.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/tab.github.io/2019/11/11/vue-directive/"><img class="prev-cover" src= "" data-lazy-src="/tab.github.io/2019/11/11/vue-directive/2701794-250949a6bda06b20.png" onerror="onerror=null;src='/tab.github.io/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">vue自定义指令的魅力</div></div></a></div><div class="next-post pull-right"><a href="/tab.github.io/2019/09/26/state-pattern/"><img class="next-cover" src= "" data-lazy-src="/tab.github.io/2019/09/26/state-pattern/rollingLoad.png" onerror="onerror=null;src='/tab.github.io/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">状态模式</div></div></a></div></nav><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="card-info-avatar is-center"><img class="avatar-img" src= "" data-lazy-src="/tab.github.io/images/avatar.jpg" onerror="this.onerror=null;this.src='/tab.github.io/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">Tab</div><div class="author-info__description">Tab</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/tab.github.io/archives/"><div class="headline">文章</div><div class="length-num">10</div></a></div><div class="card-info-data-item is-center"><a href="/tab.github.io/tags/"><div class="headline">标签</div><div class="length-num">7</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/Tabxx"><i class="fab fa-github"></i><span>Follow Me</span></a></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%89%8D%E7%AB%AF%E4%B8%8E%E5%8F%8D%E7%88%AC%E8%99%AB"><span class="toc-number">1.</span> <span class="toc-text">前端与反爬虫</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link"><span class="toc-number">1.0.1.</span> <span class="toc-text"></span></a></li></ol></li></ol></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/tab.github.io/2021/08/09/femonitor/" title="前端异常监控平台"><img src= "" data-lazy-src="/tab.github.io/2021/08/09/femonitor/IMG_2992.jpeg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="前端异常监控平台"/></a><div class="content"><a class="title" href="/tab.github.io/2021/08/09/femonitor/" title="前端异常监控平台">前端异常监控平台</a><time datetime="2021-08-09T12:25:00.000Z" title="发表于 2021-08-09 20:25:00">2021-08-09</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/tab.github.io/2021/07/08/ssr/" title="性能优化之SSR初体验"><img src= "" data-lazy-src="/tab.github.io/2021/07/08/ssr/ssr.jpg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="性能优化之SSR初体验"/></a><div class="content"><a class="title" href="/tab.github.io/2021/07/08/ssr/" title="性能优化之SSR初体验">性能优化之SSR初体验</a><time datetime="2021-07-08T06:37:22.000Z" title="发表于 2021-07-08 14:37:22">2021-07-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/tab.github.io/2021/05/15/inject/" title="Vue3.0——Provide/Inject的妙用"><img src= "" data-lazy-src="/tab.github.io/2021/05/15/inject/top.jpg" onerror="this.onerror=null;this.src='/tab.github.io/img/404.jpg'" alt="Vue3.0——Provide/Inject的妙用"/></a><div class="content"><a class="title" href="/tab.github.io/2021/05/15/inject/" title="Vue3.0——Provide/Inject的妙用">Vue3.0——Provide/Inject的妙用</a><time datetime="2021-05-15T15:07:43.000Z" title="发表于 2021-05-15 23:07:43">2021-05-15</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By Tab</div><div class="footer_custom_text">Hi, welcome to my <a href="https://tabxx.github.io/tab.github.io/">blog</a>!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/tab.github.io/js/utils.js"></script><script src="/tab.github.io/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>function loadValine () {
  function initValine () {
    const valine = new Valine(Object.assign({
      el: '#vcomment',
      appId: 'DCF6gBtqrrJYBofXtoomsqy4-gzGzoHsz',
      appKey: 'e9JXPlIRUQ8XLONSE4dsozQA',
      placeholder: 'Please leave your footprints',
      avatar: 'monsterid',
      meta: 'nick,mail,link'.split(','),
      pageSize: '10',
      lang: 'zh-CN',
      recordIP: false,
      serverURLs: '',
      emojiCDN: '',
      emojiMaps: "",
      enableQQ: false,
      path: window.location.pathname,
      requiredFields: ["nick,mail"],
      visitor: false
    }, null))
  }

  if (typeof Valine === 'function') initValine() 
  else getScript('https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js').then(initValine)
}

if ('Valine' === 'Valine' || !false) {
  if (false) btf.loadComment(document.getElementById('vcomment'),loadValine)
  else setTimeout(loadValine, 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script></div><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js"></script><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>